def ackermann(m, n):
    return n + 1 if m == 0 else ackermann(m - 1, 1) if n == 0 and m > 0 else ackermann(m - 1, ackermann(m, n - 1))

if __name__ == "__main__":
    m, n = map(int, input().split())
    print(ackermann(m, n))